﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Threading.Tasks;
using Autocentro.Respository.Mapping;
using Autocentro.Entities;


namespace Autocentro.Respository
{
    public class AUTOCENTROCONTEXT:DbContext
    {
        static AUTOCENTROCONTEXT()
        {
            Database.SetInitializer<AUTOCENTROCONTEXT>
                (
                    null          
                    //new AutocentroDatabaseInitializer()
                );
        }

        public AUTOCENTROCONTEXT()
            : base("Name=AUTOCENTROCONTEXT")
        {
            this.Configuration.LazyLoadingEnabled = false;
            this.Configuration.ProxyCreationEnabled = false;
            this.Configuration.AutoDetectChangesEnabled = false;

        }

        public DbSet<MARCA> Marca { get; set; }
        public DbSet<CLIENTE> Cliente { get; set; }
        public DbSet<PRODUCTO> Producto { get; set; }
        public DbSet<PROVEEDOR> Proveedor { get; set; }
        public DbSet<IMAGEN_TRABAJADOR> ImagenTrabajador { get; set; }
        public DbSet<TRABAJADOR> Trabajador { get; set; }
        public DbSet<VEHICULO> Vehiculo { get; set; }
        public DbSet<VENTA> Venta { get; set; }
        public DbSet<DETALLEVENTA> DetalleVenta { get; set; }
        public DbSet<PROFORMA> Proforma { get; set; }
        public DbSet<DETALLEPROFORMA> DetalleProforma { get; set; }
        public DbSet<COMPRAS> Compra { get; set; }
        public DbSet<DETALLECOMPRA> DetalleCompra { get; set; }
        public DbSet<UNIDAD_MEDIDA> UnidadMedida { get; set; }
        public DbSet<EMPRESA> Empresa { get; set; }
        public DbSet<PRODUCTO_TIPO_VEHICULO> ProductoTipoVehiculo { get; set; }
        public DbSet<TIPO_VEHICULO> TipoVehiculo { get; set; }
        public DbSet<CARTERASERVICIOPROGRAMADO> CarteraServicioProgramado { get; set; }
        public DbSet<SERVICIO_PROGRAMADO> ServicioProgramado { get; set; }
        public DbSet<ORDEN_TRABAJO> OrdenTrabajo { get; set; }
        public DbSet<DETALLE_ORDEN_TRABAJO> DetalleOrdenTrabajo { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new MarcaMap());
            modelBuilder.Configurations.Add(new ClienteMap());
            modelBuilder.Configurations.Add(new ProductoMap());
            modelBuilder.Configurations.Add(new ProveedorMap());
            modelBuilder.Configurations.Add(new ImagenTrabajadorMap());
            modelBuilder.Configurations.Add(new TrabajadorMap());
            modelBuilder.Configurations.Add(new VehiculoMap());
            modelBuilder.Configurations.Add(new VentaMap());
            modelBuilder.Configurations.Add(new DetalleVentaMap());
            modelBuilder.Configurations.Add(new ProformaMap());
            modelBuilder.Configurations.Add(new DetalleProformaMap());
            modelBuilder.Configurations.Add(new DetalleCompraMap());
            modelBuilder.Configurations.Add(new CompraMap());
            modelBuilder.Configurations.Add(new UnidadMedidaMap());
            modelBuilder.Configurations.Add(new EmpresaMap());
            modelBuilder.Configurations.Add(new Producto_Tipo_VehiculoMap());
            modelBuilder.Configurations.Add(new Tipo_VehiculoMap());
            modelBuilder.Configurations.Add(new CarteraServicioProgramadoMap());
            modelBuilder.Configurations.Add(new ServicioProgramadoMap());
            modelBuilder.Configurations.Add(new OrdenTrabajoMap());
            modelBuilder.Configurations.Add(new DetalleOrdenTrabajoMap());
            
        }
    }
}
